<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
</head>
<style>
    .patient_info {
        width: 100%;
        height: 4.5rem;
        background-color: #fff;

    }

    .patient_info .padding {
        padding: 1rem 0.8rem;
    }

    .patient_info .padding .patient_info_title {
        color: #565656;
        font-size: 0.7rem;
        font-weight: bold;
    }

    .patient_info .padding .patient_info_detail {
        margin-top: 0.6rem;
        height: 1rem;
        line-height: 1rem;
        color: #565656;
        font-size: 0.7rem;
    }

    .patient_info .padding .patient_info_detail div {
        float: right;
        margin-left: 1rem;
    }

    .patient_info .padding .patient_info_detail div input {
        height: 1rem;
        border-bottom: 1px solid #e8e8e8;
        width: 2rem;
        outline: none;
        text-align: center;
        font-size: 0.6rem;
    }

    .patient_info .padding .patient_info_detail div img {
        width: 0.6rem;
        height: 0.3rem;
    }

    textarea {
        width: 94%;
        padding: 0.5rem 3%;
        height: 6.5rem;
        outline: none;
        background-color: #fff;
        font-size: 0.6rem;
    }
</style>

<body>
    <div  id="app" v-cloak>
        <div class="placeholder_div"></div>
        <div class="patient_info">
            <div class="padding">
                <div class="patient_info_title">患者信息</div>

                <div class="patient_info_detail">忘忧草
                    <div><input type="number" placeholder="年龄">岁</div>
                    <div onclick="select_sex()"><input type="text" readonly placeholder="性别"
                            v-model="patient_sex_on"><img src="../image/icon_black_arrow.png" alt="">
                    </div>

                </div>

            </div>

        </div>
        <div class="placeholder_div"></div>

        <textarea placeholder="添加补充病历信息"></textarea>
    </div>
</body>

</html>
<script src="../script/set_root.js"></script>

<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/hb.js"></script>
<script type="text/javascript" src="../script/vue.js"></script>
<script type="text/javascript">
    apiready = function () {
        hb_ready();
    }
    //使用vue对数据进行绑定
    var app = new Vue({
        el: '#app',
        data: {
            patient_sex_on: "",
            patient_sex: ["男", "女"]
        },
        methods: {

        },

    })

    // 选择性别
    function select_sex() {
        api.actionSheet({
            title: '请选择性别',
            cancelTitle: '取消',
            buttons: app.patient_sex
        }, function (ret, err) {
            var index = ret.buttonIndex; //下标从1开始
            if(index == 3){
                return
            }
            for (var i = 0; i < app.patient_sex.length; i++) {
                if (index - 1 == i) {
                    app.patient_sex_on = app.patient_sex[i]
                }
            }

        });
    }
</script>